﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class NameUI : MonoBehaviour
{
    private UserModel user;

    private InputField InputName { get; set; }

    void Start()
    {
        user = Engine.GameSystem.ReadUser();
        InputName = transform.FindChild("InputName").GetComponent<InputField>();
        
    }

    public void ButtonFinish()
    {
        if (InputName.text.Equals(""))
        {
            EventManager.PostEvent(TipSystem.DataType.ShowTip, "未输入昵称，请输入昵称后继续。");
        }
        else
        {
            user.userName = InputName.text;
            Engine.GameSystem.WriteUser(user);
            Engine.UISystem.Next("Loading");
        }
    }
}
